/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

package com.example.omsdkdemo.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * 功能描述
 *
 * @since 2023-02-06
 */
public class DeviceReceiver extends BroadcastReceiver {
    private static final String TAG = "DeviceReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent == null || context == null) {
            Log.e(TAG, "intent or context is null");
            return;
        }
        String action = intent.getAction();
        if (action == null) {
            Log.e(TAG, "action is null");
            return;
        }
        switch (action) {
            case Intent.ACTION_SCREEN_ON:
                Log.i(TAG, "start to screen on");
                break;
            case Intent.ACTION_SCREEN_OFF:
                Log.i(TAG, "start to screen off");
                break;
            case Intent.ACTION_SHUTDOWN:
                Log.i(TAG, "start to shutdown");
                break;
            default:
                break;
        }
    }
}
